package com.behavior.chainOfResponsibility.cuisine;

import com.behavior.chainOfResponsibility.AuthInfo;
import com.behavior.chainOfResponsibility.AuthLink;
import com.behavior.chainOfResponsibility.AuthService;

import java.text.ParseException;
import java.util.Date;

/**
 * @author xiaobing
 * @version 1.0
 * @date 2021/9/22 2:30 下午
 */
public class Level3AuthLink extends AuthLink {


    public Level3AuthLink(String levelUserId, String levelUserName) throws ParseException {
        super(levelUserId, levelUserName);
    }

    @Override
    public AuthInfo doAuth(String uId, String orderId, Date authDate) {
        Date date = AuthService.queryAuthInfo(levelUserId, orderId);
        if (null == date) {
            return new AuthInfo("0001", "单号：", orderId, " 状态：待三级审批负责人 ", levelUserName);
        }
        return new AuthInfo("0000", "单号：", orderId, " 状态：三级审批负责人完成", " 时间：", f.format(date), " 审批人：", levelUserName);
    }
}
